﻿using System;
using System.Net;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace BusinessObjects
{
#if Silverlight
    [Serializable]
#else
    [DataContract]
#endif
    public class BaseBusinessObject : INotifyPropertyChanged
    {
        private int id;

        [DataMember]
        public int Id
        {
            get
            {
                return this.id;
            }
            set
            {
                if ( this.id == value )
                    return;

                this.id = value;
                this.NotifyPropertyChanged( "Id" );
            }
        }

        public virtual object Clone()
        {
            return null;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void NotifyPropertyChanged( string propertyName )
        {
            if ( this.PropertyChanged != null )
                this.PropertyChanged( this, new PropertyChangedEventArgs( propertyName ) );
        }
    }
}
